﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;



namespace MemDBAPI
{
    public enum SqlType
    {
        Int,
        Float,
        NChar
    }

    public class Parameter
    {
        public string m_parameterName;
        public SqlType m_Type;
        public Object m_Value;

        public Parameter(string parameterName, SqlType type)
        {
            m_parameterName = parameterName;
            m_Type = type;
            m_Value = null;
        }


    }

    public class ParameterCollaboration
    {
        public List<Parameter> m_Parameters;
        private bool m_DuplicateParameters;

        public ParameterCollaboration()
        {
            m_Parameters = new List<Parameter>();
            m_DuplicateParameters = false;
        }

        public Parameter Add(string parameterName, SqlType type)
        {
            if (IsParameterDuplicate(parameterName))
                m_DuplicateParameters = true;

            m_Parameters.Add(new Parameter(parameterName, type));
            return m_Parameters[m_Parameters.Count - 1];
        }

        private bool IsParameterDuplicate(string parameterName)
        {
            for(int i = 0; i < m_Parameters.Count; i++)
            {
                if (parameterName == m_Parameters[i].m_parameterName)
                    return true;
            }

            return false;
        }
    }
}
